package com.academic_system.mapper;


import com.academic_system.model.Teacher;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * @className TeacherDao
 * @Description 老师dao层
 **/
@Repository
public interface TeacherDao {

    /**
     * @param te_num
     * @Description 根据Teacher表中的老师编号查询老师个人信息
     * @methodName queryTeacherByTeNum
     * @returnType Teacher
     **/
    @Select("select * from teacher where te_num=#{te_num}")
    Teacher queryTeacherByTeNum(@Param("te_num") int te_num);


    /**
     * @param teacher
     * @Description 修改老师信息表（姓名，性别，身份证，出生年月，民族，电话，籍贯）
     * @returnType boolean
     **/
    @Update("update teacher set te_name=#{teacher.teName},te_sex=#{teacher.teSex},te_idcard_num=#{teacher.teIdcardNum},te_birthday=#{teacher.teBirthday},te_nation=#{teacher.teNation},te_phone=#{teacher.tePhone},te_nativeplace=#{teacher.teNativeplace} where te_num=#{teacher.teNum}")
    boolean updateTeacher(@Param("teacher") Teacher teacher);
     /**
          * @Description 通过老师名字查找id
          * @methodName ququeryte_info_idByte_name
          * @returnType int
          **/
    @Select("select te_info_id  from teacher where te_name=#{te_name}")
    public int ququeryte_info_idByte_name(@Param("te_name") String te_name);

    @Update("update project set project_state = #{project_state} where project_id = #{project_id}")
    boolean switchState(@Param("project_state") int project_state,@Param("project_id") int project_id);
}
